/*
 * @author wilbur.ma@qq.com
 * @date 2011.06.01
 * Requrie jquery, jquery.url and jquery.quicksearch
 * Requrie fold_lib for simple template
 */
 function cond_show_all() {
	if ($("#filter_input").val() == "")
		show_all($("#hosts > div"));
 }
 
 function cond_fold_all() {
	if ($("#filter_input").val() == "")
		fold_all($("#hosts > div"));
 }
 
 function show_cur_host() {
	fold_all_except($("#hosts > div"), $($.url().attr("fragment")));
 }
 
 window.onload = function(event) {
	$("#showall").click(function(event) { cond_show_all(); });
	$("#hideall").click(function(event) { cond_fold_all(); });
	$(".index_name").each(function() {
		$(this).click(function(event) { 
			fold_all_except($("#hosts > div"), $(this).parent());
		})
	});
	$("#filter_input").focus(function(event) {$("#filter_input").val(""); cond_fold_all()});
	$("#filter_input").quicksearch(".index_name", {
						"selector": "span",
						"bind": "keyup click"
						}
					);
    show_cur_host();
};